package com.zl.learning.io;

import com.google.common.io.Files;
import org.apache.commons.io.FileUtils;
import org.junit.Test;

import java.io.*;

public class TestFile2 {

    @Test
    public void test1() throws IOException {
        Files.copy(new File("demo"), new File("demo3"));
    }

    @Test
    public void test2() throws IOException {
        FileUtils.copyDirectory(new File("demo"), new File("demo3"));
    }

    @Test
    public void test3() throws IOException {
        FileUtils.deleteDirectory(new File("demo3"));
    }

    @Test
    public void test4() throws FileNotFoundException {
        System.setOut(new PrintStream(new FileOutputStream("1.txt")));
        System.out.println("aaa");
        System.out.println("bbb");
    }
}
